<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>移动端-视觉视口</title>
    <style>
        * {
            margin: 0;
            padding: 0
        }

        #demo {
            font-size: 40px;
            background: skyblue;
            width: 980px;
            height: 300px;
        }
    </style>
</head>

<body>
    <div id="demo"></div>

    <script>
        const demo = document.getElementById('demo');
        demo.innerHTML = '布局视口宽度：' + document.documentElement.clientWidth;
        demo.innerHTML += '视觉视口宽度：' + window.innerWidth;
    </script>
</body>

</html>